<?php

/**
 * Position filter form base class.
 *
 * @package    virtualstore
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePositionFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'employee_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Employee'), 'add_empty' => true)),
      'name'                        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'startDate'                   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'endDate'                     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'salary'                      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'payment_periodicity_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PaymentPeriodicity'), 'add_empty' => true)),
      'payment_calculation_type_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PaymentCalculationType'), 'add_empty' => true)),
      'location_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PositionLocation'), 'add_empty' => true)),
      'shift_id'                    => new sfWidgetFormFilterInput(),
      'wage_type_id'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('WageType'), 'add_empty' => true)),
      'created_at'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'created_by'                  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('created_by_fk'), 'add_empty' => true)),
      'updated_by'                  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('updated_by_fk'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'employee_id'                 => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Employee'), 'column' => 'id')),
      'name'                        => new sfValidatorPass(array('required' => false)),
      'startDate'                   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'endDate'                     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'salary'                      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'payment_periodicity_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('PaymentPeriodicity'), 'column' => 'id')),
      'payment_calculation_type_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('PaymentCalculationType'), 'column' => 'id')),
      'location_id'                 => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('PositionLocation'), 'column' => 'id')),
      'shift_id'                    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'wage_type_id'                => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('WageType'), 'column' => 'id')),
      'created_at'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_by'                  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('created_by_fk'), 'column' => 'id')),
      'updated_by'                  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('updated_by_fk'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('position_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Position';
  }

  public function getFields()
  {
    return array(
      'id'                          => 'Number',
      'employee_id'                 => 'ForeignKey',
      'name'                        => 'Text',
      'startDate'                   => 'Date',
      'endDate'                     => 'Date',
      'salary'                      => 'Number',
      'payment_periodicity_id'      => 'ForeignKey',
      'payment_calculation_type_id' => 'ForeignKey',
      'location_id'                 => 'ForeignKey',
      'shift_id'                    => 'Number',
      'wage_type_id'                => 'ForeignKey',
      'created_at'                  => 'Date',
      'updated_at'                  => 'Date',
      'created_by'                  => 'ForeignKey',
      'updated_by'                  => 'ForeignKey',
    );
  }
}
